<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>从小到大排序</title>
	</head>
	<body>
	</body>
	<script>
		alert(NULL.length);
		function sort(array){
			array = array|| []; /*避免空null的情况*/
			for(var i=0;i<array.length-1;i++){
				for(var j = 0;j<array.length-1-i;j++){
					if(array[j]>array[j+1]){
						var temp = array[j];
						array[j] = array[j+1];
						array[j+1] = temp;
					}
				}
			}
			
			return array;
		}
		
		var array =[32,12,4,67,8,1,35];
		console.log(sort(array));
	</script>
</html>
